package com.gupao.singleton;

/**
 * 单例模式    懒汉加载
 * Created by ktyan on 2017/5/23.
 */
public class Singleton {

    private static Singleton instance;

    // 构造方法私有化
    private Singleton(){}

    // 线程安全的懒加载方法
    public static synchronized Singleton getInstance(){
        if(instance == null){
            instance = new Singleton();
        }
        return instance;
    }
}
